package com.fly_fox.dao;

import com.fly_fox.entity.TaskItem;
import com.fly_fox.util.JdbcUtil;
import org.springframework.jdbc.core.BeanPropertyRowMapper;

import java.io.Serializable;
import java.util.List;

public class TaskItemDao {



    public static List<TaskItem> listByGroup(String groupName){
        String sql = JdbcUtil.ins.toSelSql(TaskItem.class, " where `group` = ? ");
        BeanPropertyRowMapper<TaskItem> rowMapper=BeanPropertyRowMapper.newInstance(TaskItem.class);
        List<TaskItem> list = JdbcUtil.ins.query(sql, rowMapper, groupName);
        return list;
    }

    public  static void delByGroup(String groupName){
        String sql = "delete from tb_task_item where `group` = ? ";
        JdbcUtil.ins.execute(sql);
    }

    public  static void delByid(Serializable id){
        JdbcUtil.ins.del(TaskItem.class,id);
    }

}
